package com.epam.employeebase.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="companies")
public class Company {
	private Long id;
	private String name;
	private Set<Office> offices = new HashSet<Office>();
	@Id
	@SequenceGenerator(name="companyGenerator", sequenceName="COMPANIES_SEQ")
	@GeneratedValue(generator="companyGenerator")
	@Column(name="id")
	public Long getId() {
		return id;
	}
	
	@Column(name="name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@OneToMany(mappedBy="company", fetch=FetchType.LAZY)
	public Set<Office> getOffices() {
		return offices;
	}
	
	public void setOffices(Set<Office> offices) {
		this.offices = offices;
	}
}
